package com.lhoverc.mapper;

import com.lhoverc.pojo.VO.LogVO;
import com.lhoverc.pojo.entity.LogEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author: LiCheng
 * @CreateTime: 2025-04-12
 * @Description:
 * @Version: 1.0
 */
@Mapper
public interface LogMapper {

    /**
     * 插入日志数据
     * @param logEntity
     */
    @Insert("insert into log (operator_id, operation_time, class_name, method_name, method_params, return_value, cost_time) " +
            "values (#{operatorId}, #{operationTime}, #{className}, #{methodName}, #{methodParams}, #{returnValue}, #{costTime})")
    public void insert(LogEntity logEntity);

    /**
     * 获取所有符合条件的log
     * @param returnValue
     * @param operationTimeStart
     * @param operationTimeEnd
     * @return
     */
    List<LogVO> getLogs(String operatorName, String returnValue, LocalDateTime operationTimeStart, LocalDateTime operationTimeEnd);
}
